<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>SB Admin</title>
  <!-- Bootstrap core CSS-->
  <link href="/fashionpress/admin/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Custom fonts for this template-->
  <link href="/fashionpress/admin/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <!-- Custom styles for this template-->
  <link href="/fashionpress/admin/css/sb-admin.css" rel="stylesheet">
</head>

<body class="bg-dark">
  <div class="container">
    <div class="card card-login mx-auto mt-5">
      <div class="card-header">Login</div>
      <div class="card-body">
        <form action="/fashionpress/admin/login" method="post" >
          <div class="form-group">
            <label for="adminUsername">Username</label>
            <input class="form-control" id="adminUsername" type="text"  placeholder="Enter username" name="adminUsername" th:value="${formAdmin!=null?formAdmin.adminUsername:''}">
          </div>
          <div class="form-group" >
            <span style="color: red; " id="checkadminname"></span>
          </div>
          <div class="form-group">
            <label for="adminPassword">Password</label>
            <input class="form-control" id="adminPassword" type="password" placeholder="Password" name="adminPassword" th:value="${formAdmin!=null?formAdmin.adminPassword:''}">
          </div>
          <div class="form-group" >
            <span style="color: red; " id="checkPassword"></span>
          </div>
          <div class="form-group" >
            <input type="submit" class="btn btn-primary btn-block" value="Login">
          </div>

        </form>
        <div class="text-center">
          <a class="d-block small" href="/fashionpress/admin/forgotPassowrd">Forgot Password?</a>
        </div>
      </div>
    </div>
  </div>
  <!-- Bootstrap core JavaScript-->
  <script src="/fashionpress/admin/vendor/jquery/jquery.min.js"></script>
  <script src="/fashionpress/admin/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- Core plugin JavaScript-->
  <script src="/fashionpress/admin/vendor/jquery-easing/jquery.easing.min.js"></script>
  <script>
    $(document).ready(function () {
      $("#adminUsername").blur(function () {
        $adminName = $("#adminUsername").val();
        $.ajax({url:"/fashionpress/admin/checkusername/"+$adminName,
          cache:true,
          async:true,
          dataType:"text",
          success: function (data,textStatus,jqXHR) {

            console.log(data);

            document.getElementById("checkadminname").innerText=data;

          }

        });

      })
    });
  </script>
<script>
  if("[[${msg}]]"!=""){
    document.getElementById("checkPassword").innerText="[[${msg}]]";
  }
</script>
</body>

</html>
